<template>
	<div>
		<div class="loan_nav col_nav">
			<ul>
				<li>
					<a href="javascript:history.go(-1)">
						<i class="iconfont">&#xe61e;</i>
					</a>
				</li>
				<li>
					<p>更多信息</p>
				</li>
				<li></li>
			</ul>
		</div>
		<div class="interval_T">

		</div>
		<div class="modify">
			<ul>
				<li>
					<group>
						<x-address title="城市" :value="value4" @on-shadow-change="onShadowChange" raw-value :list="addressData" hide-district></x-address>
					</group>
				</li>
			</ul>
			<ul>
				<li>
					<p>职业</p>
				</li>
				<li><input v-model="params.career" type="text" placeholder="未填写" /></li>
			</ul>
			<ul>
				<li>
					<p>收入</p>
				</li>
				<li><input v-model="params.income" type="text" placeholder="未填写" /></li>
			</ul>
			<div class="crude_line"></div>
		</div>
		<div class="btn">
			<input @click="save" type="button" value="保存" class="col-green" />
		</div>
	</div>
</template>
<script>
import { Group, XAddress, ChinaAddressV4Data, PopupPicker } from 'vux'
export default {
	components: {
		Group,
		XAddress,
		ChinaAddressV4Data,
		PopupPicker
	},
	data() {
		return {
			addressData: ChinaAddressV4Data,
			value4: [],
			params: {}
		}
	},
	created() {
		this.query()
	},
	methods: {
		onShadowChange (ids, names) {
	    	if(names.length > 0){
	    		this.params.province = names[0]
	    		this.params.city = names[1]
	    	}
	    },
		query() {
			this.$http.get('/app/member/userInfo').then(json => {
				const { code, user } = json
				if (code === 0) {
					const { province, city, career, income } = user
					this.params = { province, city, career, income }
					if(province && city) {
						this.value4 = [province, city]
					}
				}
			})
		},
		save() {
			this.$http.post('/app/member/modify', this.params).then(json => {
				const { code } = json
				if(code === 0) {
					this.$vux.toast.show({ text: '保存成功' })
					this.$router.back()
				}
			})
		}
	}
}
</script>
<style>
.weui-label {
  font-size: 0.26rem !important;
}
.vux-popup-picker-value {
  font-size: 0.26rem !important;
}
.weui-cell {
  padding: 0 !important;
}
.vux-no-group-title {
  margin: 0 !important;
}
.weui-cells {
  background: none !important;
}
.weui-cells:before {
  border: none !important;
}
.weui-cells:after {
  border: none !important;
}
.vux-popup-picker-placeholder {
  font-size: 0.26rem !important;
}
</style>

